#pragma once
#include <string>
#include "../../utils/common_ptr.h"

class Token
{
public:
  static Token SELECT;
  static Token DELETE;
  static Token INSERT;
  static Token UPDATE;

  static Token FROM;
  static Token HAVING;
  static Token WHERE;
  static Token ORDER;
  static Token BY;
  static Token GROUP;
  static Token INTO;
  static Token AS;

  static Token CREATE;
  static Token ALTER;
  static Token DROP;
  static Token SET;

  static Token XNULL;
  static Token NOT;
  static Token DISTINCT;

  static Token TABLE;
  static Token TABLESPACE;
  static Token VIEW;
  static Token SEQUENCE;
  static Token TRIGGER;
  static Token USER;
  static Token INDEX;
  static Token SESSION;
  static Token PROCEDURE;
  static Token FUNCTION;

  static Token PRIMARY;
  static Token KEY;
  static Token DEFAULT;
  static Token CONSTRAINT;
  static Token CHECK;
  static Token UNIQUE;
  static Token FOREIGN;
  static Token REFERENCES;

  static Token EXPLAIN;
  static Token FOR;
  static Token IF;

  static Token LOCAL;
  static Token GLOBAL;
  static Token ALL;
  static Token UNION;
  static Token EXCEPT;
  static Token INTERSECT;
  static Token MINUS;
  static Token INNER;
  static Token LEFT;
  static Token RIGHT;
  static Token FULL;
  static Token OUTER;
  static Token JOIN;
  static Token STRAIGHT_JOIN;
  static Token ON;
  static Token SCHEMA;
  static Token CAST;
  static Token COLUMN;
  static Token USE;
  static Token DATABASE;
  static Token TO;

  static Token AND;
  static Token OR;
  static Token XOR;
  static Token CASE;
  static Token WHEN;
  static Token THEN;
  static Token ELSE;
  static Token ELSIF;
  static Token END;
  static Token EXISTS;
  static Token IN;

  static Token NEW;
  static Token ASC;
  static Token DESC;
  static Token IS;
  static Token LIKE;
  static Token ESCAPE;
  static Token BETWEEN;
  static Token VALUES;
  static Token INTERVAL;

  static Token LOCK;
  static Token SOME;
  static Token ANY;
  static Token TRUNCATE;

  static Token RETURN;

  // mysql
  static Token XTRUE;
  static Token XFALSE;
  static Token LIMIT;
  static Token KILL;
  static Token IDENTIFIED;
  static Token PASSWORD;
  static Token DUAL;
  static Token BINARY;
  static Token SHOW;
  static Token REPLACE;
  static Token PERIOD;

  static Token BITS;

  // MySql procedure add by zz
  static Token WHILE;
  static Token DO;
  static Token LEAVE;
  static Token ITERATE;
  static Token REPEAT;
  static Token UNTIL;
  static Token OPEN;
  static Token CLOSE;
  static Token OUT;
  static Token INOUT;
  static Token EXIT;
  static Token UNDO;
  static Token SQLSTATE;
  static Token CONDITION;
  static Token DIV;

  // postgresql
  static Token WINDOW;
  static Token OFFSET;
  static Token ROW;
  static Token ROWS;
  static Token ONLY;
  static Token FIRST;
  static Token NEXT;
  static Token FETCH;
  static Token OF;
  static Token SHARE;
  static Token NOWAIT;
  static Token RECURSIVE;
  static Token TEMPORARY;
  static Token TEMP;
  static Token UNLOGGED;
  static Token RESTART;
  static Token IDENTITY;
  static Token CONTINUE;
  static Token CASCADE;
  static Token RESTRICT;
  static Token USING;
  static Token CURRENT;
  static Token RETURNING;
  static Token COMMENT;
  static Token OVER;
  static Token TYPE;
  static Token ILIKE;
  static Token RLIKE;
  static Token FULLTEXT;

  // oracle
  static Token START;
  static Token PRIOR;
  static Token CONNECT;
  static Token WITH;
  static Token EXTRACT;
  static Token CURSOR;
  // MODEL ;
  static Token MERGE;
  static Token MATCHED;
  static Token ERRORS;
  static Token REJECT;
  static Token UNLIMITED;
  static Token BEGIN;
  static Token EXCLUSIVE;
  static Token MODE;
  static Token WAIT;
  static Token ADVISE;
  static Token SYSDATE;
  static Token DECLARE;
  static Token EXCEPTION;
  static Token GRANT;
  static Token REVOKE;
  static Token LOOP;
  static Token GOTO;
  static Token COMMIT;
  static Token SAVEPOINT;
  static Token CROSS;

  static Token PCTFREE;
  static Token INITRANS;
  static Token MAXTRANS;
  static Token INITIALLY;
  static Token ENABLE;
  static Token DISABLE;
  static Token SEGMENT;
  static Token CREATION;
  static Token IMMEDIATE;
  static Token DEFERRED;
  static Token STORAGE;
  static Token MINEXTENTS;
  static Token MAXEXTENTS;
  static Token MAXSIZE;
  static Token PCTINCREASE;
  static Token FLASH_CACHE;
  static Token CELL_FLASH_CACHE;
  static Token NONE;
  static Token LOB;
  static Token STORE;
  static Token CHUNK;
  static Token CACHE;
  static Token NOCACHE;
  static Token LOGGING;
  static Token NOCOMPRESS;
  static Token KEEP_DUPLICATES;
  static Token EXCEPTIONS;
  static Token PURGE;

  static Token COMPUTE;
  static Token ANALYZE;
  static Token OPTIMIZE;

  // transact-sql
  static Token TOP;

  static Token ARRAY;
  static Token DISTRIBUTE;

  // hive

  static Token XEOF;
  static Token ERROR;
  static Token IDENTIFIER;
  static Token HINT;
  static Token VARIANT;
  static Token LITERAL_INT;
  static Token LITERAL_FLOAT;
  static Token LITERAL_HEX;
  static Token LITERAL_CHARS;
  static Token LITERAL_NCHARS;

  static Token CODE; // odps

  static Token LITERAL_PATH;

  static Token LITERAL_ALIAS;
  static Token LINE_COMMENT;
  static Token MULTI_LINE_COMMENT;

  // Oracle
  static Token BINARY_FLOAT;
  static Token BINARY_DOUBLE;

  // odps;hive
  static Token PARTITION;
  static Token PARTITIONED;
  static Token OVERWRITE;
  static Token SORT;
  static Token LATERAL;

  // Teradata
  static Token SEL;
  static Token LOCKING;
  static Token ACCESS;
  static Token VOLATILE;
  static Token MULTISET;
  static Token POSITION;
  static Token RANGE_N;
  static Token FORMAT;
  static Token QUALIFY;
  static Token MOD;
  static Token CONTAINS;

  static Token CONCAT;

  static Token UPSERT;

  // StarRocks
  static Token BIGINT;
  static Token BITMAP;

  static Token LPAREN;
  static Token RPAREN;
  static Token LBRACE;
  static Token RBRACE;
  static Token LBRACKET;
  static Token RBRACKET;
  static Token SEMI;
  static Token COMMA;
  static Token DOT;
  static Token DOTDOT;
  static Token DOTDOTDOT;
  static Token EQ;
  static Token GT;
  static Token LT;
  static Token LT_SUB_GT;
  static Token BANG;
  static Token BANGBANG;
  static Token BANG_TILDE;
  static Token BANG_TILDE_STAR;
  static Token TILDE;
  static Token TILDE_STAR;
  static Token TILDE_EQ;
  static Token QUES;
  static Token QUESQUES;
  static Token QUESBAR;
  static Token QUESAMP;
  static Token COLON;
  static Token COLONCOLON;
  static Token COLONEQ;
  static Token EQEQ;
  static Token EQGT;
  static Token LTEQ;
  static Token LTEQGT;
  static Token LTGT;
  static Token GTEQ;
  static Token BANGEQ;
  static Token BANGGT;
  static Token BANGLT;
  static Token AMPAMP;
  static Token BARBAR;
  static Token BARBARSLASH;
  static Token BARSLASH;
  static Token PLUS;
  static Token SUB;
  static Token SUBGT;
  static Token SUBGTGT;
  static Token STAR;
  static Token SLASH;
  static Token AMP;
  static Token BAR;
  static Token CARET;
  static Token CARETEQ;
  static Token PERCENT;
  static Token LTLT;
  static Token GTGT;
  static Token MONKEYS_AT;
  static Token MONKEYS_AT_AT;
  static Token POUND;
  static Token POUNDGT;
  static Token POUNDGTGT;
  static Token MONKEYS_AT_GT;
  static Token LT_MONKEYS_AT;
  static Token NO_EXISTING_TOKEN;

  string_ptr name;
  uint64_t index;

  Token();
  ~Token();

  Token(Token *token);
  Token(const char *name, uint64_t index);
  Token(string_ptr name, uint64_t index);
  bool operator==(const Token &ps);
  bool operator!=(const Token &ps);
  uint64_t get_index();
  string_ptr getName() { return name; }
};
